/*
 *  Plain old data for the trader data 
 *  Pulled in at the start of the trading day.
 */

import java.util.ArrayList;

public class TraderInfo {
	int traderIDNumber;// We've switched to numeric ID.
	String traderID;// Should rename to traderName once we can refactor.
	int fundsAvailable;
	ArrayList<String> ores;
	ArrayList<Integer> oreAvailable;
	
	//testing only
	public TraderInfo(){
		//creates the null trader
		traderID = "null";
		fundsAvailable = 0;
		ores = new ArrayList<String>();
		oreAvailable = new ArrayList<Integer>();
		traderIDNumber = 0;
		
	}
	
	// testing only
	public TraderInfo(String name, int funds){
		traderID = name;
		fundsAvailable = funds;
		ores = new ArrayList<String>();
		oreAvailable = new ArrayList<Integer>();
		traderIDNumber = 0;
	}
	
	// use this constructor for real data. The other two lack a unique id and
	// should only be used for testing
	public TraderInfo(int idnum, String name, int funds){
		traderID = name;
		traderIDNumber = idnum;
		
	}
		
	public void addOre(String ore, int amount){
		ores.add(ore);
		oreAvailable.add(amount);
	}
	
	public int hasOre(String ore){
		// returns the amount of ore available to trade
		// 0 indicates the ore isn't available
		for (int i = 0; i < ores.size(); i++){
			if (ore.compareTo(ores.get(i)) == 0){
				return oreAvailable.get(i);
			}
		}
		return 0;
		
	}
}
